package com.ehotting.edsta.circuitDesign.gen.arguments.script;

import com.ehotting.edsta.circuitDesign.domain.EsCircuitCodeDataTemplate;
import com.ehotting.edsta.circuitDesign.domain.EsRuleScript;
import com.ehotting.edsta.circuitDesign.gen.element.enums.ScriptTypeEnum;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CustomArgumentsScript extends ArgumentsScriptAbstract {

    // -----------自定义-----------

    // 2：自定义脚本
    @Override
    public String invoke(EsRuleScript esRule, List<String> argumentsList, List<EsCircuitCodeDataTemplate> outputParamList, String functionName) {
        // 1、定义方法头部
        StringBuffer buf = new StringBuffer();
        buf.append(methodStart(functionName, argumentsList));

        buf.append(esRule.getContent());

        // 1、方法结束
        buf.append(this.methodEnd());
        return buf.toString();
    }

    public boolean isTrue(ScriptTypeEnum code){
        return ScriptTypeEnum.CUSTOM == code;
    }

    @Override
    public String getExample() {
        return null;
    }

}
